perm filename FASTS[E,ALS] blob
sn#143231 filedate 1975-02-05 generic text, type C, neo UTF8
COMMENT ā VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 MOVEI A,1
C00006 ENDMK
Cā;
MOVEI A,1
MOVEM A,JCNT ;Probably not needed
SETZB B,G
MOVE A,ARRLIN ;Set by SETARR to line for action
ADD A,[440700,,LLDESC] ;Location where text starts
HRRZM A,JPTR ;Location of source line
MOVE D,[440700,,BUF]
MOVEM D,JWPT ;Buffer pointer at start
MOVE Q,SUBBUF(E) ;Substitution text location
ADD Q,[440700,,0]
SETOM BUF
MOVE T,[BUF,,BUF+1]
BLT T,BUF+37 ;Set up buffer properly
MOVN B,SRCOFF ;Character position to start deletion
HRLZS B
ILDB C,A
IDPB C,D ;Copy text to deletion point
AOBJN B,.-2
HRL B,SRCSIZ(E)
IBP A ;Index over replaced text
SUB B,[1,,1] ;Count space saved
JUMPG B,.-2
MOVN T,SUBSIZ(E) ;Get size of substitution string
HRL B,T
MOVNS T
ADD T,B
SUBI T,149 ;Test for possible overflow
JUMPG T,SUBOVE
ILDB C,Q
IDPB C,D
AOBJN B,.-2
HRL B,T ;This will test for overflow again
ILDB C,A
JUMPE C,****
IDPB C,D
AOBJN B,.-3
JRST SUBOVE
****: IDPB C,D
TLNE D,760000
JRST .-2 ;Pad out with nulls
;Now we must give up the space originally used by the line
MOVE A,JPTR ;Location of line
LDB T,[111100,,1(A)] ;Get 2nd 9 bits from right of 1(A)
MOVNI T,(T) ;and do 1's complement of T
ADDM T,CHAR ;add this to # in CHARS or ATTSIZ.
; SOS @JLPTR(E) ;Subtract 1 from # in LINES or ATTNUM.
HRRZ C,(A) ;Get line forward pointer
MOVEM C,JPTR ;and put it in JPTR.
MOVSI T,JPTR ;with JPTR location in left half
HLLM T,(C) ;of pointer for line pointed to.
PUSHJ P,FSGIVE ;Give up storage space.
;Then we create a new line with proper pointers
ADDI G,2(B) ;Increase G by 2 + # of characters
ADDM G,CHAR ;Previously debited by the number in original line
LSH G,11 ;Move G to byte position.
IORI G,(B) ;IOR in the actual char count.
MOVEI B,-BUF+1+LLDESC(A) ;Number of words.
PUSHJ P,FSGET ;Get space to store line.
MOVSI TT,BUF ;Starting location of source
HRRI TT,LLDESC(A) ;and starting location of destination.
BLT TT,-2(T) ;and now BLT, ending at location -2(T)
MOVSI T,TXTCOD ;A fancy way to store 2 in left half!
HLLM T,-1(A) ;To 1st header word.
HRRZM G,1(A) ;Char. cnts in right of 3rd header word.
AOS T,TXTNUM
MOVEM T,2(A) ;To 4th header word.
HLRZ T,JLPT
CAIE T,PAGE
SKIPGE 1(T)
TRO F,UPDTXT ;Flag change in first line.
TRO F,WRITE
HRLI T,JLPT
MOVSM T,(A)
HRRM A,(T)
HRLZM A,JLPT
MOVE A,D
SUBOVE: OUTSTR [ASCIZ /
Substitution will cause line to exceed LINE-BUFFER size.
Do you want this? (Y or N) /]